﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TransStockDetail.aspx.cs" Inherits="Transfer_TransStockDetail" %>

<%@ Register Assembly="WX.WMS.Common" Namespace="WX.WMS.Common" TagPrefix="cc1" %>
<%@ Import Namespace="WX.WMS.DataModel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head id="Head1" runat="server">
        <title>调仓单维护</title>
        
    <link href="../css/base.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="../JavaScript/jq.js"></script>
        <script type="text/javascript" src="../JavaScript/ymPrompt.js"></script>  
        <script type="text/javascript" src="../JavaScript/AjaxJS.js"></script>
            <script type="text/javascript">
            function submitCheck()
            {
             var item=document.getElementById('TransStockID');
             if(item.value=='') {
                alert('调仓单号不能为空');
                return　false;
             }
             item = document.getElementById('TransStockDate');
             if(item.value=='') {
                alert('调仓日期不能为空');
                return　false;
             }
           	    
            }
        function yinyong_onclick() {

            var Url="../Product/NQ_Products_CommonWindow.aspx?type=ck";
            var result=window.showModalDialog(Url,'','dialogWidth:690px;status:no;dialogheight:500px');   
            if(result!=null)
            {          
               var item=document.getElementById("<%=StoreID.ClientID %>");
               item.value=result;
               __doPostBack('UpdateDetail','');
            }else
            {
              
            }


        }   	
        function SaveValidate()
        {

         var OutStockCode =document.getElementById("OutStockCode");
         var PacketQty =document.getElementById("PacketQty");
         var PacketQty2 =document.getElementById("PacketQty2");
         var NetWeight =document.getElementById("NetWeight");
          var GrossWeight =document.getElementById("GrossWeight");
          var BarCode =document.getElementById("BarCode");
//                if(BarCode.value=="")
//          {
//	                    alert('请选择商品');
//                         return false;
//          }
          if(OutStockCode.value=="")
          {
	                    alert('请输入出仓单号');
                         return false;
          }
                if(!/^\d+(\.\d+)?$/.test(NetWeight.value))
                {
                    alert("净重格式不正确,应该为数值");               
                 
		           return false;
                }
                if(!/^\d+(\.\d+)?$/.test(GrossWeight.value))
                {
                    alert("毛重格式不正确，应该为数值");               
                 
		           return false;
                } 
                if(!/^\d+(\.\d+)?$/.test(PacketQty.value))
                {
                    alert("大件数应该是整数");
                   
                  
		           return false;
                }    
               if(!/^\d+(\.\d+)?$/.test(PacketQty2.value))
                {
                    alert("小件数应该是整数");
                   
                  
		           return false;
                }                                 
        }
            </script>
                        <style type="text/css">
            .hidden
            {
            	 display:none;
            	}
                            .style1
                            {
                                width: 69px;
                            }
                            .style3
                            {
                                height: 26px;
                            }
                            .style5
                            {
                                width: 69px;
                                height: 26px;
                            }
                            .style6
                            {
                                width: 128px;
                                height: 26px;
                            }
                            .style8
                            {
                                height: 26px;
                                width: 91px;
                            }
                            .style12
                            {
                                width: 73px;
                            }
                            .style13
                            {
                                width: 128px;
                            }
                            .style14
                            {
                                width: 119px;
                            }
                            .style15
                            {
                                width: 119px;
                                height: 26px;
                            }
                            .style16
                            {
                                width: 91px;
                            }
            </style>
    </head>
    <body>
        
        <form id="form1" runat="server">
            <input id="SupplierID" style="width: 17px" type="hidden" />
        <div  style="margin:0 auto; width:100%;  text-align:center;">
            <DIV  
    style="BORDER-RIGHT: #a4d5e3 1px solid; margin:20px auto; width:750px; BORDER-TOP: #a4d5e3 1px solid; BACKGROUND: url(../images/content_bg1.gif) repeat-x 50% bottom; BORDER-LEFT: #a4d5e3 1px solid;  BORDER-BOTTOM: #a4d5e3 1px solid; ">
        <TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0  >
      <TBODY>
      <TR>
        <TD class=title align=middle height=50>
            <asp:Label ID="lblTitle" runat="server" Text="Label"></asp:Label>
           </TD></TR>
      <TR>
        <TD bgColor=#ffffff style="height: 118px" valign="top">
          <TABLE cellSpacing=1 cellPadding=1 width="700" align=center border=0>
            <TBODY>
            <TR>
              <TD bgColor=#ffffff style="width: 240px; height: 9px;">制单日期：
                  <asp:TextBox ID="CreateTime" runat="server" Width="111px" CssClass="txt_left" ReadOnly="True"></asp:TextBox>
                  </TD>        
              <%--<TD bgColor=#ffffff style="width: 220px; height: 9px;">调仓单号：<asp:TextBox ID="TransStockID" runat="server" Width="150px" CssClass="txt_left" ></asp:TextBox>
              </TD>

              <TD bgColor=#ffffff style="height: 9px;" align="left">
                  出库类型 ：
                  <asp:DropDownList ID="Type" runat="server">
                  </asp:DropDownList>
                  </TD>--%>
              <TD bgColor=#ffffff style="width: 220px; height: 9px;">序列号：<asp:TextBox ID="SerialNo" runat="server" Width="150px" CssClass="txt_left" ReadOnly="true" ></asp:TextBox>
              </TD>
              <%--<TD bgColor=#ffffff style="height: 9px;" align="left">
                  调仓日期：<asp:TextBox ID="TransStockDate" runat="server" Width="90px" CssClass="txt_left"  ></asp:TextBox>&nbsp;
                  <IMG 
                style="CURSOR: hand" 
                onclick="fPopUpCalendarDlg(OutStockDate);return false;" height=16 
                alt=弹出日历下拉菜单 src="../images/calendar.gif" width=16>
                  </TD>--%>
           </TR>
            <%--<TR>

              <TD bgColor=#ffffff style="width: 240px; height: 9px;">贸易方式：
                  <asp:TextBox ID="Trade" runat="server" Width="111px" CssClass="txt_left"> </asp:TextBox>
                  </TD>
              <TD bgColor=#ffffff style="width: 220px; height: 9px;">运输方式：<asp:TextBox ID="Transfer" runat="server" Width="150px" CssClass="txt_left" ></asp:TextBox>
              </TD>              
              <TD bgColor=#ffffff style="height: 9px;" align="left">
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;客户： 
                  <asp:DropDownList ID="Client" runat="server"  DataTextField="NAME" DataValueField="ID">
                  </asp:DropDownList>
                  </TD>
           </TR>      --%>
            <%--<TR>

              <TD bgColor=#ffffff style="width: 240px; height: 9px;">提货车牌：
                  <asp:TextBox ID="CarNO" runat="server" Width="111px" CssClass="txt_left" ></asp:TextBox>
                  </TD>
              <TD bgColor=#ffffff style="width: 220px; height: 9px;">&nbsp;&nbsp;&nbsp;班次号：<asp:TextBox ID="TransferNO" runat="server" Width="150px" CssClass="txt_left" ></asp:TextBox>
              </TD>              
              <TD bgColor=#ffffff style="height: 9px;" align="left">
                  调仓日期：<asp:TextBox ID="TransStockDate" runat="server" Width="90px" CssClass="txt_left"  ></asp:TextBox>&nbsp;
                  <IMG 
                style="CURSOR: hand" 
                onclick="fPopUpCalendarDlg(OutStockDate);return false;" height=16 
                alt=弹出日历下拉菜单 src="../images/calendar.gif" width=16>
                  </TD>
           </TR> --%>          
            <TR>
              <TD bgColor=#ffffff colSpan=3 style="height: 34px">
                  <asp:Button ID="MainSave" runat="server" Text="生成调仓单" 
                      OnClientClick="return submitCheck();" onclick="MainSave_Click" />
                  <asp:Button ID="MainDelete" runat="server" Text="删除该单" Visible="false" 
                      OnClientClick="javascript:if(!confirm('您确定要删除吗?'))return  false;" 
                      onclick="MainDelete_Click" />
                   <asp:Button ID="MainFinish" runat="server" Text="完成所有" Visible="false" 
                      OnClientClick="javascript:if(!confirm('您确定完成所有吗?'))return  false;" 
                      onclick="MainFinish_Click" />
                  <%-- <asp:Button ID="MainFinish0" runat="server" Text="返回列表" 
                      onclick="MainFinish0_Click"   />--%>
                   </TD>
                   </TR></TBODY></TABLE></TD></TR>
      </TBODY></TABLE>
      </div>
            <div   runat="server" visible="false" id="DetailDiv"
    style="BORDER-RIGHT: #a4d5e3 1px solid; margin:20px auto; width:750px; BORDER-TOP: #a4d5e3 1px solid; BACKGROUND: url(../images/content_bg1.gif) repeat-x 50% bottom; BORDER-LEFT: #a4d5e3 1px solid;  BORDER-BOTTOM: #a4d5e3 1px solid; ">
      <table border="0" style="width: 743px;" cellpadding="0" cellspacing="0" >
      <tr>
        <td height="24" align="right" class="style16">商品：</td>
        <td class="style14"><input id="ProductsName" style="width: 55px" type="text" class="txt_left" runat="server" readonly="readonly" />
            <input id="yinyong" type="button" value="引用" onclick="return yinyong_onclick()" /></td>
        <td align="right" class="style1">条形码：</td>
        <td class="style14">
        <input id="BarCode"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly" />
         <input id="ProductDetailID"  type="hidden" runat="server" />
        </td>
        <td style="width: 60px" align="right"><p >型号：</p></td>
        <td class="style13"><input id="Model"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly" />
            </td>
        <td align="right" class="style12"><p >规格：</p></td>
        <td ><input id="Standard"  style="width: 99px" type="text" class="txt_left"   runat="server" readonly="readonly"/>
            </td>        
      </tr>
      <tr>
        <td height="24" align="right" class="style16">产地：</td>
        <td class="style14"><input id="Origin" style="width: 99px" type="text" class="txt_left"   runat="server" readonly="readonly"/>
            <input id="Hidden1" style="width: 17px" type="hidden" />
                                </td>
        <td  align="right" class="style1">牌子：</td>
        <td class="style14"><input id="Brand"  style="width: 99px" type="text" class="txt_left"   runat="server" readonly="readonly"/></td>
        <td  align="right"><p >柜号：</p></td>
        <td class="style13"><input id="PacketNO"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly"/>
            </td>
        <td align="right" class="style12"><p >关键规格：</p></td>
        <td ><input id="KeyStandard"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly"/>
            </td>        
      </tr>  
      <tr>
        <td height="24"  align="right" class="style16">主批次：</td>
        <td class="style14"><input id="LotNumber" style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly" />
            <input id="Hidden2" style="width: 17px" type="hidden" />
                                </td>
        <td  align="right" class="style1">次批次：</td>
        <td class="style14"><input id="SubLotNumber"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly"/></td>
        <td  align="right"><p >原始日期：</p></td>
        <td class="style13"><input id="ProductedDate"  style="width: 99px" type="text" class="txt_left"   runat="server" readonly="readonly"/>
            </td>
        <td align="right" class="style12"><p >类型：</p></td>
        <td ><input id="StockType"  style="width: 99px" type="text" class="txt_left"  
                runat="server" readonly="readonly"/></td>        
      </tr>  
      <tr>
        <td height="24"  align="right" class="style16">供应商批次：</td>
        <td class="style3">
            <input id="SupplyLotNumber" style="width: 120px" type="text" class="txt_left"  runat="server" readonly="readonly" />
                                </td>
        <td  align="right" class="style1">货物大类：</td>
        <td class="style5">
            <input id="BigClass"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly"/></td>
        <td  align="right"><p ></p></td>
        <td class="style1"></td>
        <td align="right"><p ></p></td>
        <td ></td>    
      </tr>   
      <tr>
        <td  align="right" class="style8">移出库位：</td>
        <td class="style15"><input id="Stock" style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly" />
            <input id="Hidden3" style="width: 17px" type="hidden" />
                                </td>
        <td  align="right" class="style5">移出库区：</td>
        <td class="style15"><input id="Area"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly"/></td>
        <td  align="right" class="style3"><p >移出层：</p></td>
        <td class="style6">
        <input id="Floor"  style="width: 99px" type="text" class="txt_left"   runat="server" readonly="readonly"/>
                        <input id="FloorID"   type="hidden" runat="server" />
            </td>
        <td align="right" class="style12"><p >尺寸：</p></td>
        <td ><input id="Size"  style="width: 99px" type="text" class="txt_left"  runat="server" readonly="readonly"/>
            </td>        
      </tr>    
      <tr>
        <td height="24"  align="right" class="style16">移入库位：</td>
        <td class="style14">
                        <asp:DropDownList ID="StockTo" runat="server"  AutoPostBack="true" Width="99px" 
                            DataValueField="STOCK_ID" DataTextField="STOCK_NAME" onselectedindexchanged="StockTo_SelectedIndexChanged"
                            >
                        </asp:DropDownList>&nbsp;<input id="Hidden4" style="width: 17px" type="hidden" /></td>
        <td  align="right" class="style1">移入库区：</td>
        <td class="style14">
                        <asp:DropDownList ID="AreaTo" runat="server" AutoPostBack="true" Width="99px"   
                            DataValueField="AREA_ID" DataTextField="AREA_NAME" onselectedindexchanged="AreaTo_SelectedIndexChanged"
                            >
                        </asp:DropDownList>
                        </td>
        <td  align="right"><p >移入层：</p></td>
        <td class="style13">
                        <asp:DropDownList  DataValueField="FloorID" DataTextField="FloorName" Width="99px" 
                            ID="FloorTo" runat="server">
                        </asp:DropDownList>
                        &nbsp;<input id="Hidden5"   type="hidden" runat="server" /></td>
        <td align="right" class="style12"><p >&nbsp;</p></td>
        <td >&nbsp;</td>        
      </tr>                            
<tr>
        <td height="24"  align="right" class="style16">大件数：</td>
        <td class="style14">
            <input id="PacketQty"  style="width: 99px" type="text" class="txt_left"  
                runat="server" /></td>
        <td  align="right" class="style1">小件数：</td>
        <td class="style14">
            <input id="PacketQty2"  
                style="width: 99px" type="text" class="txt_left"  runat="server" /></td>
        <td  align="right">净重：</td>
        <td class="style13">
        <input id="NetWeight"  style="width: 99px" type="text" class="txt_left"  runat="server" /></td>
        <td align="right" class="style12">毛重：</td>
        <td ><input id="GrossWeight" style="width: 99px" type="text" class="txt_left"   
                runat="server"/></td>        
      </tr>      
      <tr>
        <td height="22"  align="right" class="style16">描述：</td>
        <td colspan="6"><input id="Remark" type="text" style="width: 90%" class="txt_left"  runat="server" />
            
        </td>
        <td><asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="../images/Save.gif"   OnClientClick="return SaveValidate();"
                onclick="ImageButton1_Click" /></td>
      </tr>
    </table>
      </div>
            
      <div  style="BORDER-RIGHT: #a4d5e3 1px solid; margin:20px auto; width:750px; BORDER-TOP: #a4d5e3 1px solid; BACKGROUND: url(../images/content_bg1.gif) repeat-x 50% bottom; BORDER-LEFT: #a4d5e3 1px solid;  BORDER-BOTTOM: #a4d5e3 1px solid; ">
            <cc1:GridView ID="SearchResult" runat="server" AutoGenerateColumns="False" 
                BackColor="White" AllowPaging="True"
                BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                Width="100%" DataKeyNames="ID"  
              CheckTemplateStyle="CheckTemplateStyle" EnableEmptyContentRender="True" 
              RadioBoxKeyName="radioId" SelectBoxKeyName="CheckItem" ShowRadioBox="False" 
              ShowSelectBox="False" 
              onrowdeleting="SearchResult_RowDeleting" 
              onpageindexchanging="SearchResult_PageIndexChanging"   >
                <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                <Columns>
  <%--                  <asp:BoundField DataField="OUTSTOCK_CODE" HeaderText="出仓单号" SortExpression="T_PRODUCT_DETAIL.T_PRODUCT.NAME" />--%>
                     <asp:TemplateField HeaderText="商品名称" SortExpression="T_SYS_ROLE.NAME">
                     <ItemTemplate>
                      <%# ((T_TRANSFER_DETAIL)Container.DataItem).T_PRODUCT_DETAIL.T_PRODUCT.NAME%>
                     </ItemTemplate>                 
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="条形码" SortExpression="T_PRODUCT_DETAIL.BAR_CODE">
                     <ItemTemplate>
                      <%# ((T_TRANSFER_DETAIL)Container.DataItem).T_PRODUCT_DETAIL.BAR_CODE%>
                     </ItemTemplate>                 
                     </asp:TemplateField>
                     <asp:TemplateField HeaderText="移出位置" SortExpression="T_FLOOR.FloorName">
                     <ItemTemplate>
                      <%# ((T_TRANSFER_DETAIL)Container.DataItem).T_FLOOR.T_STOCK_AREA.T_STOCK.STOCK_NAME 
                          + "-->" + ((T_TRANSFER_DETAIL)Container.DataItem).T_FLOOR.T_STOCK_AREA.AREA_NAME 
                          + "-->" + ((T_TRANSFER_DETAIL)Container.DataItem).T_FLOOR.FloorName%>
                     </ItemTemplate>                 
                     </asp:TemplateField>            
                     <asp:TemplateField HeaderText="移进位置" SortExpression="T_FLOOR.FloorName">
                     <ItemTemplate>
                      <%# ((T_TRANSFER_DETAIL)Container.DataItem).T_FLOOR1.T_STOCK_AREA.T_STOCK.STOCK_NAME
                          + "-->" + ((T_TRANSFER_DETAIL)Container.DataItem).T_FLOOR1.T_STOCK_AREA.AREA_NAME
                          + "-->" + ((T_TRANSFER_DETAIL)Container.DataItem).T_FLOOR1.FloorName%>
                     </ItemTemplate>                 
                     </asp:TemplateField>                             
                     <asp:TemplateField HeaderText="大件数" SortExpression="PACKET_QTY">
                     <ItemTemplate>
                     <%# ((T_TRANSFER_DETAIL)Container.DataItem).PACKET_QTY%>
                     </ItemTemplate>                 
                     </asp:TemplateField>        
                     <asp:TemplateField HeaderText="小件数" SortExpression="PACKET_QTY2">
                     <ItemTemplate>
                      <%# ((T_TRANSFER_DETAIL)Container.DataItem).PACKET_QTY2%>
                     </ItemTemplate>                 
                     </asp:TemplateField>       
                     <asp:TemplateField HeaderText="净重" SortExpression="NET_WEIGHT">
                     <ItemTemplate>
                         <%# ((T_TRANSFER_DETAIL)Container.DataItem).NET_WEIGHT%>
                     </ItemTemplate>                 
                     </asp:TemplateField>         
                     <asp:TemplateField HeaderText="毛重" SortExpression="GROSS_WEIGHT">
                     <ItemTemplate>
                        <%# ((T_TRANSFER_DETAIL)Container.DataItem).GROSS_WEIGHT%>
                     </ItemTemplate>                 
                     </asp:TemplateField>                                                                    
<%--                    <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="SysUserManager.aspx?action=edit&amp;ID={0}"
                        HeaderText="编辑" Text="&lt;img border=0 src=../images/Edit.gif /&gt;">
                        <ItemStyle Width="30px" />
                    </asp:HyperLinkField>--%>
                    <asp:CommandField DeleteText="&lt;img border=0 src=../images/Close.gif /&gt;" ShowDeleteButton="True" HeaderText="删除" />                    
<%--                    <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="SysUserSearch.aspx?action=del&amp;ID={0}"
                        HeaderText="删除" Text="&lt;img border=0 src=../images/Close.gif /&gt;">
                        <ItemStyle Width="30px" />
                    </asp:HyperLinkField>--%>
                </Columns>
                <RowStyle BackColor="White" ForeColor="#003399" />
                <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
                <HeaderStyle BackColor="#E2F3FA" Font-Bold="True" ForeColor="Black" />
            </cc1:GridView>
      </div>
            <asp:LinkButton ID="UpdateDetail" runat="server" onclick="LinkButton1_Click"  CssClass="hidden">LinkButton</asp:LinkButton>
            <asp:TextBox ID="StoreID" runat="server" Text=""   CssClass="hidden"></asp:TextBox>
    </div>
        </form>
    </body>
    </html>
